/**
 * 
 */
package com.fsoft.tinhcd.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author caodangtinh
 * 
 */
@Entity
@Table(name = "department", schema = "hibernate")
public class Department {
	private int departmentId;
	private String departmentName;
	Set<Employee> employees = new HashSet<Employee>();

	public Department() {
	}

	/**
	 * @param departmentName
	 */
	public Department(String departmentName) {
		super();
		this.departmentName = departmentName;
	}

	/**
	 * @param departmentName
	 * @param employees
	 */
	public Department(String departmentName, Set<Employee> employees) {
		super();
		this.departmentName = departmentName;
		this.employees = employees;
	}

	/**
	 * @return the departmentId
	 */
	@Id
	@GeneratedValue
	@Column(name = "DEPARTMENT_ID", unique = true)
	public int getDepartmentId() {
		return departmentId;
	}

	/**
	 * @param departmentId
	 *            the departmentId to set
	 */
	public void setDepartmentId(int departmentId) {
		this.departmentId = departmentId;
	}

	/**
	 * @return the departmentName
	 */
	@Column(name = "DEPARTMENT_NAME", length = 50)
	public String getDepartmentName() {
		return departmentName;
	}

	/**
	 * @param departmentName
	 *            the departmentName to set
	 */
	public void setDepartmentName(String departmentName) {
		this.departmentName = departmentName;
	}

	/**
	 * @return the employees
	 */
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "department")
	public Set<Employee> getEmployees() {
		return employees;
	}

	/**
	 * @param employees
	 *            the employees to set
	 */
	public void setEmployees(Set<Employee> employees) {
		this.employees = employees;
	}

}
